Sql |
SELECT distinct a.style_id,
case a.style_id
when 277788 then 1
when 252140 then 2
when 325092 then 3
when 111282 then 4
when 307708 then 5
when 250908 then 6
when 251130 then 7
when 293114 then 8
when 330773 then 9
when 249821 then 10
when 161707 then 11
when 252143 then 12
when 208510 then 13
when 249820 then 14
when 251016 then 15
when 330776 then 16
when 250278 then 17
when 251013 then 18
when 251014 then 19
when 251015 then 20
when 257093 then 21
when 250279 then 22
when 103058 then 23
when 250414 then 24
when 250417 then 25
when 250412 then 26
when 250413 then 27
when 250416 then 28
when 331231 then 29
when 262805 then 30
when 250280 then 31
when 252145 then 32
when 252615 then 33
when 318163 then 34
when 119047 then 35
when 252616 then 36
when 323148 then 37
when 325056 then 38
when 123171 then 39
when 325057 then 40
when 28048 then 41
when 216180 then 42
when 264149 then 43
when 280350 then 44
when 318164 then 45
when 325049 then 46
when 176233 then 47
when 325058 then 48
when 325048 then 49
when 325053 then 50
when 325055 then 51
when 280295 then 52
when 280296 then 53
when 325060 then 54
when 325047 then 55
when 325054 then 56
when 217715 then 57
when 323613 then 58
when 325051 then 59
when 325061 then 60
when 270872 then 61
when 272135 then 62
when 330763 then 63
when 42149 then 64
when 256944 then 65
when 252526 then 66
when 42147 then 67
when 276869 then 68
when 13224 then 69
when 254188 then 70
when 196855 then 71
when 256114 then 72
when 207651 then 73
when 263527 then 74
when 267988 then 75
when 42190 then 76
when 40333 then 77
when 269823 then 78
when 33161 then 79
when 256089 then 80
when 204277 then 81
when 133499 then 82
when 272113 then 83
when 326866 then 84
when 138672 then 85
when 250105 then 86
when 40264 then 87
when 267726 then 88
when 207971 then 89
when 254361 then 90
when 254534 then 91
when 124790 then 92
when 196853 then 93
when 252077 then 94
when 255305 then 95
when 248738 then 96
when 263976 then 97
when 264560 then 98
when 279006 then 99
when 260614 then 100
when 255170 then 101
when 130944 then 102
when 272532 then 103
when 273460 then 104
when 273996 then 105
when 286923 then 106
when 285976 then 107
when 323030 then 108
when 191521 then 109
when 255606 then 110
when 260519 then 111
when 263977 then 112
when 267543 then 113
when 266382 then 114
when 266938 then 115
when 267162 then 116
when 267626 then 117
when 267627 then 118
when 250230 then 119
when 74999 then 120
when 274650 then 121
when 279895 then 122
when 284324 then 123
when 196646 then 124
when 24020 then 125
when 50966 then 126
when 51469 then 127
when 318135 then 128
when 292578 then 129
when 24205 then 130
when 176014 then 131
when 42153 then 132
when 319705 then 133
when 262998 then 134
when 270968 then 135
when 325406 then 136
when 325407 then 137
when 197019 then 138
when 220437 then 139
when 249146 then 140
when 250474 then 141
when 198057 then 142
when 263368 then 143
when 316807 then 144
when 51481 then 145
when 134374 then 146
when 225976 then 147
when 253623 then 148
when 264673 then 149
when 212081 then 150
when 212080 then 151
when 4436 then 152
when 188897 then 153
when 51493 then 154
when 203829 then 155
when 42767 then 156
when 142866 then 157
when 267633 then 158
when 271061 then 159
when 178639 then 160
when 145809 then 161
when 260634 then 162
when 264827 then 163
when 264511 then 164
when 319702 then 165
when 319707 then 166
when 318140 then 167
when 263620 then 168
when 263584 then 169
when 42176 then 170
when 42175 then 171
when 267159 then 172
when 277787 then 173
when 325404 then 174
when 255249 then 175
when 220439 then 176
when 248732 then 177
when 256279 then 178
when 262597 then 179
when 264556 then 180
when 24204 then 181
when 56034 then 182
when 272136 then 183
when 272086 then 184
when 319706 then 185
when 191929 then 186
when 246411 then 187
when 276021 then 188
when 42588 then 189
when 4489 then 190
when 198341 then 191
when 103403 then 192
when 207223 then 193
when 209852 then 194
when 223106 then 195
when 262051 then 196
when 262582 then 197
when 322169 then 198
when 252123 then 199
when 276029 then 200
when 252556 then 201
when 253050 then 202
when 261351 then 203
when 264971 then 204
when 267148 then 205
when 264840 then 206
when 274003 then 207
when 277253 then 208
when 279925 then 209
when 19436 then 210
when 330739 then 211
when 267923 then 212
when 33131 then 213
when 173663 then 214
when 206955 then 215
when 216724 then 216
when 266208 then 217
when 268633 then 218
when 268520 then 219
when 319703 then 220
when 220438 then 221
when 34533 then 222
when 133911 then 223
when 173676 then 224
when 51464 then 225
when 42647 then 226
when 173060 then 227
when 203788 then 228
when 51499 then 229
when 208033 then 230
when 98806 then 231
when 219887 then 232
when 255311 then 233
when 114673 then 234
when 34530 then 235
when 276011 then 236
when 310596 then 237
when 213549 then 238
when 90478 then 239
when 275754 then 240
when 278329 then 241
when 24066 then 242
when 9190 then 243
when 210614 then 244
when 263244 then 245
when 264013 then 246
when 266869 then 247
when 267145 then 248
when 267146 then 249
when 281014 then 250
when 325405 then 251
when 138591 then 252
when 4487 then 253
when 170047 then 254
when 173976 then 255
when 117177 then 256
when 189940 then 257
when 197983 then 258
when 200324 then 259
when 206062 then 260
when 208114 then 261
when 42590 then 262
when 247025 then 263
when 249101 then 264
when 249100 then 265
when 254490 then 266
when 256197 then 267
when 113776 then 268
when 80785 then 269
when 267743 then 270
when 268634 then 271
when 271985 then 272
when 277925 then 273
when 283307 then 274
when 283236 then 275
when 326171 then 276
when 322167 then 277
when 322240 then 278
when 322176 then 279
when 256948 then 280
when 250231 then 281
when 310025 then 282
when 108647 then 283
when 251544 then 284
when 319730 then 285
when 319731 then 286
when 260610 then 287
when 276030 then 288
when 281316 then 289
when 204163 then 290
when 208344 then 291
when 209602 then 292
when 213176 then 293
when 255250 then 294
when 73347 then 295
when 261715 then 296
when 263643 then 297
when 278987 then 298
when 282567 then 299
when 283480 then 300
when 122001 then 301
when 183830 then 302
when 24035 then 303
when 216392 then 304
when 105735 then 305
when 118285 then 306
when 161572 then 307
when 156359 then 308
when 169178 then 309
when 4490 then 310
when 10066 then 311
when 189941 then 312
when 195587 then 313
when 42650 then 314
when 189944 then 315
when 196312 then 316
when 110581 then 317
when 205614 then 318
when 206135 then 319
when 191505 then 320
when 207652 then 321
when 206642 then 322
when 76572 then 323
when 216452 then 324
when 218234 then 325
when 217353 then 326
when 246239 then 327
when 249078 then 328
when 249097 then 329
when 250775 then 330
when 225241 then 331
when 253381 then 332
when 254110 then 333
when 255058 then 334
when 264677 then 335
when 151627 then 336
when 261223 then 337
when 260500 then 338
when 260499 then 339
when 267731 then 340
when 267716 then 341
when 262695 then 342
when 268564 then 343
when 268533 then 344
when 268547 then 345
when 283253 then 346
when 112354 then 347
when 326277 then 348
when 326343 then 349
when 61988 then 350
when 256546 then 351
when 19265 then 352
when 263647 then 353
when 266407 then 354
when 116776 then 355
when 272646 then 356
when 297064 then 357
when 277867 then 358
when 97644 then 359
when 24690 then 360
when 40265 then 361
when 132672 then 362
when 137068 then 363
when 252864 then 364
when 257313 then 365
when 260873 then 366
when 279003 then 367
when 292448 then 368
when 114245 then 369
when 164016 then 370
when 121871 then 371
when 105786 then 372
when 92044 then 373
when 129644 then 374
when 163595 then 375
when 164054 then 376
when 4455 then 377
when 4499 then 378
when 193474 then 379
when 105440 then 380
when 154939 then 381
when 197153 then 382
when 205874 then 383
when 34498 then 384
when 209754 then 385
when 64005 then 386
when 115241 then 387
when 214879 then 388
when 214880 then 389
when 223107 then 390
when 72668 then 391
when 251275 then 392
when 201696 then 393
when 4454 then 394
when 4456 then 395
when 92035 then 396
when 262731 then 397
when 266826 then 398
when 260671 then 399
when 251530 then 400
when 267698 then 401
when 267723 then 402
when 281157 then 403
when 282192 then 404
when 282193 then 405
when 283333 then 406
when 283293 then 407
when 283324 then 408
when 257309 then 409
when 289822 then 410
when 293115 then 411
when 327065 then 412
when 276889 then 413
when 302503 then 414
when 24078 then 415
when 61987 then 416
when 61328 then 417
when 281318 then 418
when 99708 then 419
when 262050 then 420
when 268645 then 421
when 252227 then 422
when 40384 then 423
when 305113 then 424
when 188740 then 425
when 260611 then 426
when 263707 then 427
when 61504 then 428
when 306777 then 429
when 319988 then 430
when 115648 then 431
when 129222 then 432
when 179857 then 433
when 4473 then 434
when 34475 then 435
when 178740 then 436
when 203786 then 437
when 206136 then 438
when 206063 then 439
when 10152 then 440
when 218578 then 441
when 215113 then 442
when 216798 then 443
when 42591 then 444
when 117841 then 445
when 254163 then 446
when 120676 then 447
when 263630 then 448
when 262517 then 449
when 268735 then 450
when 267694 then 451
when 260457 then 452
when 268535 then 453
when 268615 then 454
when 268586 then 455
when 268552 then 456
when 268557 then 457
when 268525 then 458
when 276168 then 459
when 283235 then 460
when 283321 then 461
when 283249 then 462
when 326868 then 463
when 19311 then 464
when 19199 then 465
when 75311 then 466
when 204162 then 467
when 137071 then 468
when 250076 then 469
when 251090 then 470
when 251216 then 471
when 253049 then 472
when 276571 then 473
when 279404 then 474
when 42360 then 475
when 281591 then 476
when 232166 then 477
when 208343 then 478
when 289545 then 479
when 42386 then 480
when 33127 then 481
when 115012 then 482
when 132413 then 483
when 163426 then 484
when 164017 then 485
when 200784 then 486
when 111410 then 487
when 183927 then 488
when 206171 then 489
when 193992 then 490
when 208509 then 491
when 105844 then 492
when 109493 then 493
when 217324 then 494
when 225911 then 495
when 247964 then 496
when 117923 then 497
when 254198 then 498
when 256837 then 499
when 251658 then 500
when 262766 then 501
when 262657 then 502
when 266210 then 503
when 111031 then 504
when 266698 then 505
when 262718 then 506
when 4479 then 507
when 267702 then 508
when 267646 then 509
when 267652 then 510
when 267644 then 511
when 268513 then 512
when 268550 then 513
when 232004 then 514
when 232010 then 515
when 263182 then 516
when 146887 then 517
when 281135 then 518
when 282189 then 519
when 283327 then 520
when 255965 then 521
when 286245 then 522
when 303612 then 523
when 316823 then 524
when 316822 then 525
when 321310 then 526
when 323407 then 527
when 326185 then 528
when 190031 then 529
when 260773 then 530
when 263711 then 531
when 266937 then 532
when 250235 then 533
when 266218 then 534
when 267629 then 535
when 270975 then 536
when 268035 then 537
when 272918 then 538
when 272921 then 539
when 273511 then 540
when 246187 then 541
when 305111 then 542
when 137066 then 543
when 75326 then 544
when 61140 then 545
when 209598 then 546
when 209604 then 547
when 61910 then 548
when 114866 then 549
when 162514 then 550
when 74010 then 551
when 248323 then 552
when 252020 then 553
when 251884 then 554
when 262135 then 555
when 273961 then 556
when 276022 then 557
when 270353 then 558
when 42356 then 559
when 281278 then 560
when 281280 then 561
when 281279 then 562
when 283474 then 563
when 269995 then 564
when 285027 then 565
when 287624 then 566
when 61912 then 567
when 24019 then 568
when 29665 then 569
when 34611 then 570
when 290507 then 571
when 290493 then 572
when 102206 then 573
when 263640 then 574
when 252728 then 575
when 264831 then 576
when 169896 then 577
when 192359 then 578
when 145075 then 579
when 173045 then 580
when 170122 then 581
when 130883 then 582
when 4492 then 583
when 148804 then 584
when 4420 then 585
when 34505 then 586
when 192469 then 587
when 179127 then 588
when 173577 then 589
when 205613 then 590
when 168086 then 591
when 206590 then 592
when 209838 then 593
when 121748 then 594
when 196623 then 595
when 79854 then 596
when 117921 then 597
when 115249 then 598
when 179445 then 599
when 215127 then 600
when 214268 then 601
when 217321 then 602
when 216565 then 603
when 218073 then 604
when 210595 then 605
when 148853 then 606
when 227239 then 607
when 227237 then 608
when 163604 then 609
when 249104 then 610
when 257086 then 611
when 257153 then 612
when 262668 then 613
when 260501 then 614
when 262728 then 615
when 262542 then 616
when 263566 then 617
when 267718 then 618
when 267757 then 619
when 268562 then 620
when 267724 then 621
when 268597 then 622
when 268537 then 623
when 268534 then 624
when 262632 then 625
when 273335 then 626
when 271460 then 627
when 277870 then 628
when 281065 then 629
when 281106 then 630
when 281627 then 631
when 275681 then 632
when 283281 then 633
when 283383 then 634
when 283216 then 635
when 287953 then 636
when 260509 then 637
when 321309 then 638
when 78108 then 639
when 122374 then 640
when 38013 then 641
when 262123 then 642
when 153360 then 643
when 173044 then 644
when 150142 then 645
when 159158 then 646
when 136888 then 647
when 192489 then 648
when 111812 then 649
when 196823 then 650
when 197407 then 651
when 206199 then 652
when 206701 then 653
when 206703 then 654
when 206064 then 655
when 211590 then 656
when 218074 then 657
when 217339 then 658
when 216985 then 659
when 217073 then 660
when 247206 then 661
when 227184 then 662
when 250777 then 663
when 247509 then 664
when 251662 then 665
when 266205 then 666
when 266209 then 667
when 267769 then 668
when 267721 then 669
when 267728 then 670
when 268591 then 671
when 260672 then 672
when 145805 then 673
when 269517 then 674
when 262540 then 675
when 274368 then 676
when 283222 then 677
when 283239 then 678
when 283220 then 679
when 283248 then 680
when 321311 then 681
when 326858 then 682
when 326870 then 683
when 326840 then 684
when 326860 then 685
when 204283 then 686
when 213550 then 687
when 225434 then 688
when 251061 then 689
when 273571 then 690
when 276023 then 691
when 264833 then 692
when 310068 then 693
when 305114 then 694
when 74032 then 695
when 141436 then 696
when 181910 then 697
when 118075 then 698
when 4472 then 699
when 188226 then 700
when 184440 then 701
when 146896 then 702
when 105845 then 703
when 204865 then 704
when 207387 then 705
when 207675 then 706
when 216828 then 707
when 216448 then 708
when 227258 then 709
when 215121 then 710
when 51478 then 711
when 246968 then 712
when 247088 then 713
when 247506 then 714
when 251017 then 715
when 247856 then 716
when 262350 then 717
when 263585 then 718
when 117840 then 719
when 215558 then 720
when 262723 then 721
when 262641 then 722
when 263937 then 723
when 267766 then 724
when 267758 then 725
when 267755 then 726
when 268527 then 727
when 267752 then 728
when 267725 then 729
when 268650 then 730
when 268598 then 731
when 268531 then 732
when 268532 then 733
when 263279 then 734
when 262734 then 735
when 277718 then 736
when 281110 then 737
when 281169 then 738
when 276808 then 739
when 283380 then 740
when 283382 then 741
when 283375 then 742
when 283312 then 743
when 227540 then 744
when 278479 then 745
when 305062 then 746
when 261063 then 747
when 261066 then 748
when 261068 then 749
when 261067 then 750
when 264580 then 751
when 282091 then 752
when 310735 then 753
when 24059 then 754
when 202621 then 755
when 202597 then 756
when 34612 then 757
when 34622 then 758
when 9206 then 759
when 9208 then 760
when 34625 then 761
when 109120 then 762
when 98896 then 763
when 163772 then 764
when 186774 then 765
when 209186 then 766
when 210124 then 767
when 219787 then 768
when 219788 then 769
when 61871 then 770
when 75328 then 771
when 272920 then 772
when 136213 then 773
when 72613 then 774
when 61383 then 775
when 203932 then 776
when 281277 then 777
when 61911 then 778
when 72640 then 779
when 269073 then 780
when 283687 then 781
when 283613 then 782
when 61875 then 783
when 296828 then 784
when 262056 then 785
when 329592 then 786
when 61132 then 787
when 61986 then 788
when 8950 then 789
when 214580 then 790
when 216501 then 791
when 74062 then 792
when 215945 then 793
when 219960 then 794
when 61495 then 795
when 250125 then 796
when 280403 then 797
when 144630 then 798
when 287332 then 799
when 287331 then 800
when 198959 then 801
when 287622 then 802
when 310056 then 803
when 147375 then 804
when 147380 then 805
when 74052 then 806
when 264846 then 807
when 262129 then 808
when 262122 then 809
when 252726 then 810
when 109933 then 811
when 4415 then 812
when 168718 then 813
when 182257 then 814
when 193082 then 815
when 183925 then 816
when 194252 then 817
when 89240 then 818
when 206129 then 819
when 225836 then 820
when 248898 then 821
when 246316 then 822
when 255291 then 823
when 253445 then 824
when 262414 then 825
when 268053 then 826
when 263247 then 827
when 261624 then 828
when 262686 then 829
when 267712 then 830
when 263911 then 831
when 268647 then 832
when 268652 then 833
when 268625 then 834
when 135171 then 835
when 270603 then 836
when 262645 then 837
when 262636 then 838
when 271463 then 839
when 263183 then 840
when 263180 then 841
when 262109 then 842
when 262553 then 843
when 196624 then 844
when 262573 then 845
when 276811 then 846
when 283377 then 847
when 283335 then 848
when 283389 then 849
when 283214 then 850
when 250158 then 851
when 300554 then 852
when 302501 then 853
when 34604 then 854
when 66863 then 855
when 209478 then 856
when 119335 then 857
when 78387 then 858
when 148015 then 859
when 9341 then 860
when 255165 then 861
when 304902 then 862
when 173046 then 863
when 161616 then 864
when 196160 then 865
when 148083 then 866
when 122492 then 867
when 200347 then 868
when 194353 then 869
when 99435 then 870
when 175712 then 871
when 206138 then 872
when 209466 then 873
when 210582 then 874
when 210181 then 875
when 210182 then 876
when 210594 then 877
when 207674 then 878
when 217352 then 879
when 227240 then 880
when 246969 then 881
when 247081 then 882
when 250159 then 883
when 253393 then 884
when 249095 then 885
when 257299 then 886
when 251528 then 887
when 261487 then 888
when 263009 then 889
when 262721 then 890
when 257225 then 891
when 263570 then 892
when 264548 then 893
when 267163 then 894
when 263621 then 895
when 263935 then 896
when 267753 then 897
when 268237 then 898
when 267722 then 899
when 261615 then 900
when 262652 then 901
when 268507 then 902
when 268514 then 903
when 254343 then 904
when 268623 then 905
when 268603 then 906
when 268504 then 907
when 254329 then 908
when 263275 then 909
when 263177 then 910
when 270153 then 911
when 263229 then 912
when 280525 then 913
when 281080 then 914
when 276807 then 915
when 283329 then 916
when 283340 then 917
when 289394 then 918
when 276947 then 919
when 302502 then 920
when 145797 then 921
when 216376 then 922
when 191530 then 923
when 34613 then 924
when 40369 then 925
when 9185 then 926
when 61714 then 927
when 19204 then 928
when 61985 then 929
when 61812 then 930
when 61489 then 931
when 74038 then 932
when 74060 then 933
when 221122 then 934
when 74034 then 935
when 221121 then 936
when 193213 then 937
when 95558 then 938
when 261506 then 939
when 42321 then 940
when 310070 then 941
when 323786 then 942
when 323785 then 943
when 323789 then 944
when 323788 then 945
when 75323 then 946
when 209185 then 947
when 210126 then 948
when 219789 then 949
when 277297 then 950
when 305086 then 951
when 261069 then 952
when 207533 then 953
when 250015 then 954
when 251679 then 955
when 78114 then 956
when 263544 then 957
when 33138 then 958
when 74127 then 959
when 216381 then 960
when 107533 then 961
when 305486 then 962
when 136733 then 963
when 178964 then 964
when 117288 then 965
when 207636 then 966
when 211793 then 967
when 64569 then 968
when 216751 then 969
when 254206 then 970
when 254275 then 971
when 261377 then 972
when 262717 then 973
when 262713 then 974
when 262719 then 975
when 261622 then 976
when 147172 then 977
when 262432 then 978
when 267674 then 979
when 261617 then 980
when 262697 then 981
when 268636 then 982
when 268511 then 983
when 260454 then 984
when 262637 then 985
when 262647 then 986
when 270601 then 987
when 271462 then 988
when 263924 then 989
when 271464 then 990
when 262539 then 991
when 262485 then 992
when 277646 then 993
when 279661 then 994
when 287504 then 995
when 300551 then 996
when 322433 then 997
when 202658 then 998
when 202667 then 999
when 19202 then 1000
else 1000
end as ranking,
max(a.non_invt) as non_invt,sum(qoh + qc) as available,max(a.dept) as dept,max(a.brand) as brand,max(a.of3) as of3,case when sum(qoh + qc) > 0 then 1 else 0 end as instock
FROM web_all_products a WITH (NOLOCK)
INNER JOIN dbo.tb_skus b WITH (NOLOCK) ON (a.style_id = b.style_id)
INNER JOIN dbo.tb_sku_buckets c WITH (NOLOCK) ON (b.sku_id = c.sku_id and c.store_id in (10,32))
INNER JOIN dbo.tb_styles_web_taxonomy d WITH (NOLOCK) ON (a.style_id = d.style)
INNER JOIN dbo.tb_styles qq WITH (NOLOCK) ON (qq.style_id = a.style_id)
where a.style_id in (277788,252140,325092,111282,307708,250908,251130,293114,330773,249821,161707,252143,208510,249820,251016,330776,250278,251013,251014,251015,257093,250279,103058,250414,250417,250412,250413,250416,331231,262805,250280,252145,252615,318163,119047,252616,323148,325056,123171,325057,28048,216180,264149,280350,318164,325049,176233,325058,325048,325053,325055,280295,280296,325060,325047,325054,217715,323613,325051,325061,270872,272135,330763,42149,256944,252526,42147,276869,13224,254188,196855,256114,207651,263527,267988,42190,40333,269823,33161,256089,204277,133499,272113,326866,138672,250105,40264,267726,207971,254361,254534,124790,196853,252077,255305,248738,263976,264560,279006,260614,255170,130944,272532,273460,273996,286923,285976,323030,191521,255606,260519,263977,267543,266382,266938,267162,267626,267627,250230,74999,274650,279895,284324,196646,24020,50966,51469,318135,292578,24205,176014,42153,319705,262998,270968,325406,325407,197019,220437,249146,250474,198057,263368,316807,51481,134374,225976,253623,264673,212081,212080,4436,188897,51493,203829,42767,142866,267633,271061,178639,145809,260634,264827,264511,319702,319707,318140,263620,263584,42176,42175,267159,277787,325404,255249,220439,248732,256279,262597,264556,24204,56034,272136,272086,319706,191929,246411,276021,42588,4489,198341,103403,207223,209852,223106,262051,262582,322169,252123,276029,252556,253050,261351,264971,267148,264840,274003,277253,279925,19436,330739,267923,33131,173663,206955,216724,266208,268633,268520,319703,220438,34533,133911,173676,51464,42647,173060,203788,51499,208033,98806,219887,255311,114673,34530,276011,310596,213549,90478,275754,278329,24066,9190,210614,263244,264013,266869,267145,267146,281014,325405,138591,4487,170047,173976,117177,189940,197983,200324,206062,208114,42590,247025,249101,249100,254490,256197,113776,80785,267743,268634,271985,277925,283307,283236,326171,322167,322240,322176,256948,250231,310025,108647,251544,319730,319731,260610,276030,281316,204163,208344,209602,213176,255250,73347,261715,263643,278987,282567,283480,122001,183830,24035,216392,105735,118285,161572,156359,169178,4490,10066,189941,195587,42650,189944,196312,110581,205614,206135,191505,207652,206642,76572,216452,218234,217353,246239,249078,249097,250775,225241,253381,254110,255058,264677,151627,261223,260500,260499,267731,267716,262695,268564,268533,268547,283253,112354,326277,326343,61988,256546,19265,263647,266407,116776,272646,297064,277867,97644,24690,40265,132672,137068,252864,257313,260873,279003,292448,114245,164016,121871,105786,92044,129644,163595,164054,4455,4499,193474,105440,154939,197153,205874,34498,209754,64005,115241,214879,214880,223107,72668,251275,201696,4454,4456,92035,262731,266826,260671,251530,267698,267723,281157,282192,282193,283333,283293,283324,257309,289822,293115,327065,276889,302503,24078,61987,61328,281318,99708,262050,268645,252227,40384,305113,188740,260611,263707,61504,306777,319988,115648,129222,179857,4473,34475,178740,203786,206136,206063,10152,218578,215113,216798,42591,117841,254163,120676,263630,262517,268735,267694,260457,268535,268615,268586,268552,268557,268525,276168,283235,283321,283249,326868,19311,19199,75311,204162,137071,250076,251090,251216,253049,276571,279404,42360,281591,232166,208343,289545,42386,33127,115012,132413,163426,164017,200784,111410,183927,206171,193992,208509,105844,109493,217324,225911,247964,117923,254198,256837,251658,262766,262657,266210,111031,266698,262718,4479,267702,267646,267652,267644,268513,268550,232004,232010,263182,146887,281135,282189,283327,255965,286245,303612,316823,316822,321310,323407,326185,190031,260773,263711,266937,250235,266218,267629,270975,268035,272918,272921,273511,246187,305111,137066,75326,61140,209598,209604,61910,114866,162514,74010,248323,252020,251884,262135,273961,276022,270353,42356,281278,281280,281279,283474,269995,285027,287624,61912,24019,29665,34611,290507,290493,102206,263640,252728,264831,169896,192359,145075,173045,170122,130883,4492,148804,4420,34505,192469,179127,173577,205613,168086,206590,209838,121748,196623,79854,117921,115249,179445,215127,214268,217321,216565,218073,210595,148853,227239,227237,163604,249104,257086,257153,262668,260501,262728,262542,263566,267718,267757,268562,267724,268597,268537,268534,262632,273335,271460,277870,281065,281106,281627,275681,283281,283383,283216,287953,260509,321309,78108,122374,38013,262123,153360,173044,150142,159158,136888,192489,111812,196823,197407,206199,206701,206703,206064,211590,218074,217339,216985,217073,247206,227184,250777,247509,251662,266205,266209,267769,267721,267728,268591,260672,145805,269517,262540,274368,283222,283239,283220,283248,321311,326858,326870,326840,326860,204283,213550,225434,251061,273571,276023,264833,310068,305114,74032,141436,181910,118075,4472,188226,184440,146896,105845,204865,207387,207675,216828,216448,227258,215121,51478,246968,247088,247506,251017,247856,262350,263585,117840,215558,262723,262641,263937,267766,267758,267755,268527,267752,267725,268650,268598,268531,268532,263279,262734,277718,281110,281169,276808,283380,283382,283375,283312,227540,278479,305062,261063,261066,261068,261067,264580,282091,310735,24059,202621,202597,34612,34622,9206,9208,34625,109120,98896,163772,186774,209186,210124,219787,219788,61871,75328,272920,136213,72613,61383,203932,281277,61911,72640,269073,283687,283613,61875,296828,262056,329592,61132,61986,8950,214580,216501,74062,215945,219960,61495,250125,280403,144630,287332,287331,198959,287622,310056,147375,147380,74052,264846,262129,262122,252726,109933,4415,168718,182257,193082,183925,194252,89240,206129,225836,248898,246316,255291,253445,262414,268053,263247,261624,262686,267712,263911,268647,268652,268625,135171,270603,262645,262636,271463,263183,263180,262109,262553,196624,262573,276811,283377,283335,283389,283214,250158,300554,302501,34604,66863,209478,119335,78387,148015,9341,255165,304902,173046,161616,196160,148083,122492,200347,194353,99435,175712,206138,209466,210582,210181,210182,210594,207674,217352,227240,246969,247081,250159,253393,249095,257299,251528,261487,263009,262721,257225,263570,264548,267163,263621,263935,267753,268237,267722,261615,262652,268507,268514,254343,268623,268603,268504,254329,263275,263177,270153,263229,280525,281080,276807,283329,283340,289394,276947,302502,145797,216376,191530,34613,40369,9185,61714,19204,61985,61812,61489,74038,74060,221122,74034,221121,193213,95558,261506,42321,310070,323786,323785,323789,323788,75323,209185,210126,219789,277297,305086,261069,207533,250015,251679,78114,263544,33138,74127,216381,107533,305486,136733,178964,117288,207636,211793,64569,216751,254206,254275,261377,262717,262713,262719,261622,147172,262432,267674,261617,262697,268636,268511,260454,262637,262647,270601,271462,263924,271464,262539,262485,277646,279661,287504,300551,322433,202658,202667,19202)
and ltrim(rtrim(lower(a.brand))) = 'western auto'
and a.of3='12 GA'
group by a.style_id
order by instock desc, ranking asc
|